package LeetCode.month02.day55;

public class No98 {
    TreeNode pre;
    public boolean isValidBST(TreeNode root) {
        if(root==null) return true;
        if(!isValidBST(root.left)) return false;
        if(pre!=null){
            if(pre.val>=root.val) return false;
        }
        pre = root;
        if(!isValidBST(root.right)) return false;
        return true;
    }
}
